package com.bachelor.community.mapper;

import com.bachelor.community.model.entity.Collection;
import com.bachelor.community.model.vo.AnswerVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CollectionMapper extends BaseMapper<Collection> {
    @Select("select collection.create_time collectionCreateTime, answer.*, collection.user_id from collection " +
            "join user on collection.user_id=user.id join answer on collection.answer_id=answer.id where collection.user_id=#{userId}")
    IPage<AnswerVO> listCollections(IPage<AnswerVO> page, Integer userId);
}
